<?php

class Office_services_m extends CI_Model{
	
	function __construct(){
		parent::__construct();
		$this->load->model('user');
	}
	function get_office_by_user($client_id){
		$this->db->where('client_id',$client_id);
		$office = $this->db->get('services');
		return ($office->num_rows() > 0) ? $office->result():false;
	}
	function add_office_services(){
		$user = $this->user->get_user_info();

		$office = array(
			'client_id' => $user->id,
			'office_categories' => implode(',',$this->input->post('categories')),
			'sales_contact_email' => $this->input->post('sales_contact_email'),
			'sales_contact_phone1' => $this->input->post('sales_contact_phone1'),
			'sales_contact_phone2' => $this->input->post('sales_contact_phone2'),
		);
		//adding office..
		
		
		$office_res = $this->db->insert('services',$office); // inserting office info..
		
		return ($office_res) ? true:var_dump(mysql_error());
	}

}// end office model class